<template>
  <div>
    <div class="notify mb10">
      <svg-icon icon-class="tongzhi" class-name="tongzhi mr10"></svg-icon>
      <span>要去重庆咯~暂停更新</span>
    </div>
    <el-card class="article-list">
      <!-- todo 文章列表应该要提取出来 -->
      <div class="article-item" v-for="item in total" :key="item">
        <div
          class="article-item-cover"
          @click="() => $router.push('/detail')"
        ></div>
        <section class="article-item-info">
          <h1 @click="() => $router.push('/detail')">这是测试文章</h1>
          <p>
            这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介这是测试文章的简介
          </p>
          <!-- 添加文章的用户信息 -->
          <div class="article-item-footer">
            <a>曾小晨</a>
            <span class="separator">/</span>
            <a>2020-02-24</a>
            <span class="separator">/</span>
            <a>IT</a>
            <span class="separator">/</span>
            <a>0 阅读</a>
            <span class="separator">/</span>
            <a>0 评论</a>
          </div>
        </section>
      </div>
    </el-card>
  </div>
</template>

<script>
import scroll from "@/mixins/scroll";
export default {
  name: "Home",
  mixins: [scroll],
  data() {
    return {
      total: 10,
      appendSelector: ".article-list .el-card__body"
    };
  },
  methods: {
    infiniteScrollAction() {
      this.showScrollLoading = true;
      setTimeout(() => {
        this.total += 10;
        this.showScrollLoading = false;
      }, 2000);
    }
  }
};
</script>
<style lang="scss" scoped>
@import "../styles/color";
.notify {
  padding: 10px 20px;
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 4px 10px rgba(0, 0, 0, 0.06);
  background: #fff;
  line-height: 1px;
  span {
    font-size: 12px;
  }
  svg,
  span {
    vertical-align: middle;
  }
}
.hot-article-item {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 18.2%;
  height: 0;
  padding-bottom: 20%;
  background: url("https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png")
    center no-repeat;
  background-size: cover;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  &:not(:last-child) {
    margin-right: 2%;
  }
  .hot-article-title {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 40px;
    line-height: 40px;
    color: $default;
    background: #fff;
    text-align: center;
  }
}
.article-list {
  /*margin-top: 10px;*/
  min-height: 100px;
}

.article-item {
  padding: 20px 0;
  box-sizing: content-box;
  border-bottom: 1px solid #f2f2f2;
  border-radius: 4px;
  min-height: 140px;
  display: flex;
  flex-direction: row;
  &:first-child {
    /*margin-bottom: 10px;*/
    padding-top: 0;
  }
}
.article-item-cover {
  width: 22%;
  background: url("https://www.mantouxia.com/usr/uploads/2020/01/526405828.png")
    center no-repeat;
  background-size: cover;
  border-radius: 4px;
  cursor: pointer;
}
.article-item-footer {
  color: #939393;
  padding-left: 20px;
  line-height: 20px;
  span,
  a {
    vertical-align: sub;
    font-size: 11px;
  }
}
.article-item-info {
  flex: 1;
  h1 {
    padding: 10px 10px 10px 20px;
    font-weight: normal;
    font-size: 18px;
    cursor: pointer;
    /*&:hover {*/
    /*  color: #3a8ee6;*/
    /*}*/
  }
  p {
    margin: 0 10px 10px 20px;
    font-size: 14px;
    color: #999;
    line-height: 20px;
    height: 60px;
    overflow: hidden;
  }
}

/deep/.svg-icon.tongzhi {
  width: 15px;
  height: 15px;
}
</style>
